<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="org.swim.entity.User" %>
<%@ page import="org.swim.entity.Ability" %>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>Help Request</title>
	<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
	<%@ include file="NavBar.jsp" %>
	<div class="container">
	<h1>Send an help Request</h1>
		<% 
		boolean rights = (Boolean) request.getAttribute("rights"); 
		if (rights == true) { 
			User user = (User) request.getAttribute("user");  %>
			<p>You are sending an help request to: <% out.print(user.getNome() + " " + user.getCognome()); %></p>
			<form action="SendHelpRequest" method="post">
			<input type="hidden" name="user" value="<% out.print(user.getId()); %>">
				  <label>Text</label>
				  <textarea rows="3" name="text"></textarea>
				  <label>Ability</label>
				  <% List<Ability> userAbility = (List<Ability>) request.getAttribute("userabilities");
					for(Ability current: userAbility) { %>
					<label class="radio">
  					<input type="radio" name="ability" <% out.print("value=\"" + current.getIdAbilita() + "\""); %>><% out.print(current.getNome()); %>
					</label>	
					<% } %>
				<button type="submit" class="btn">Submit</button>
			</form>
		<% } else { %>
			<%@ include file="NoRights.jsp" %>	
		<% } %>
	</div>
</body>
</html>